//
//  CoreDataManager.h
//  BasketballClub
//
//  Created by dhz on 16/1/19.
//  Copyright © 2016年 孙鸿吉. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import <UIKit/UIKit.h>


@class NewsModel;
@class SkillModel;
@class VideoModel;
@class OwnerView;
@class LoginView;
@interface CoreDataManager : NSObject

@property(nonatomic,strong)NSManagedObjectContext *context;

+(instancetype)shareCoreDateManager;

-(void)create;
#pragma mark  - 数据的插入

#pragma mark --- 插入Video到数据库中

-(void)insertVideoDataToSql:(VideoModel*)model;
#pragma mark --- 插入News数据到数据库中
///NBA
-(void)insertNBANewsDataToSql:(NewsModel*)model;
///CBA
-(void)insertCBANewsDataToSql:(NewsModel*)model;
#pragma mark --- 插入Skill数据到数据库中
-(void)insertSkillDataToSql:(SkillModel*)model;


///存储个人设置页面的设置
-(void)insertOwnerDataToSql:(OwnerView *)view with:(LoginView *)login ;


#pragma mark - 数据的更改

-(void)updateOwnerBackGroundImage:(UIImageView*)imageView withUserName:(NSString *)userName;

-(void)updateOwnerHeadImage:(UIImageView*)imageView withUserName:(NSString *)userName;

-(void)updateOwnerUserStyle:(NSString*)userStyle withUserName:(NSString *)userName;

-(void)updateOwnerNickName:(NSString*)nickName withUserName:(NSString *)userName;






#pragma mark - 数据的查找

-(NSArray*)selectAllNewsNBAModel;

-(NSArray*)selectAllNewsCBAModel;

-(NSArray*)selectAllSkillModel;

-(NSArray*)selectAllVideoModel;



#pragma mark -  数据的删除
-(void)deleteFromNewsModelWithID:(NSString*)ID;

-(void)deleteFromSkillModelWithID:(NSInteger)ID;

-(void)deleteFromVideoModelWithID:(NSInteger)ID;

-(void)deleteNBANewsAllData;
-(void)deleteCBANewsAllData;
-(void)deleteSkillAllData;
-(void)deleteVideoAllData;

@end
